initMenus();
function initMenus() {
	$.ajax({
		url: 'http://localhost:8080/Online-student/RoleController/getMenusByRid',
		type: 'get',
		async: false,
		data: {
			rid: sessionStorage.getItem("rid")
		},
		dataType: 'json',
		success: function(result) {
			console.log(result);
			if (result.status == 0) {
				for (var i = 0; i < result.data.length; i++) {
					var li1 = '<li class="layui-nav-item">' +
						'<a href="javascript:;">' + result.data[i].title + '</a>' +
						'<dl class="layui-nav-child">';
					var dd = '';
					var menusList = result.data[i].menusList;
					for (var j = 0; j < menusList.length; j++) {
						dd += '<dd><a href="' + menusList[j].href + '" target="main">' + menusList[j]
							.title + '</a></dd>'
					}
					var li2 = '</dl></li>';
					var li = li1 + dd + li2;
					$("#menus").append(li);
				}
			}
		}
	})
}

login();
function login() {
	if(null==sessionStorage.getItem("user")){
		window.location = 'http://127.0.0.1:8848/onlineStudent-web/Login/login.html';
	}
}

